﻿<UserControl x:Class="BlogWriter.Wpf.Views.LoginView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:dp="clr-namespace:BlogWriter.Wpf.DependencyProperties"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             Style="{StaticResource {x:Type UserControl}}">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="10" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="10" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="10" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock Grid.Column="0" Grid.Row="0" Text="Username" />
        <TextBlock Grid.Column="0" Grid.Row="2" Text="Password" />
        <TextBlock Grid.ColumnSpan="3" Grid.Row="4" Foreground="Red" Text="{Binding ErrorMessage}" />

        <TextBox Grid.Column="2" Grid.Row="0" Text="{Binding Username}" />
        <PasswordBox Grid.Column="2" Grid.Row="2" dp:PasswordBox.Password="{Binding Password}" />

        <Grid Grid.ColumnSpan="99" Grid.Row="4" HorizontalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="5" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Button Grid.Column="1" Content="Register" Command="{Binding OpenRegistrationCommand}" />
            <Button Grid.Column="3" Content="Login" Command="{Binding LoginCommand}" />
        </Grid>
    </Grid>
</UserControl>
